﻿using DevExpress.XtraEditors;
using MDIDemo.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DevMy.PublicSetUp
{
    public class Class_ComboBoxEdit
    {
        public void SetComboBoxEdit(ComboBoxEdit comboBoxEdit, Class_Dictionary[] class_Dictionaries)
        {
            comboBoxEdit.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            comboBoxEdit.Properties.Appearance.Options.UseFont = true;
            comboBoxEdit.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            comboBoxEdit.Properties.Items.Clear();
            comboBoxEdit.SelectedIndex = -1;
            if (class_Dictionaries != null)
            {
                int index = 0;
                foreach (Class_Dictionary item in class_Dictionaries)
                {
                    comboBoxEdit.Properties.Items.Add(item.id);
                    if (item.defaultSelect)
                        comboBoxEdit.SelectedIndex = index;
                    index++;
                }
            }
        }
    }
}
